package com.sang.demo04;

import com.sang.demo02.UserService;
import com.sang.demo02.UserServiceImpl;

public abstract class Client {

    public static void main(String[] args) {
        //真实角色
        UserServiceImpl userService = new UserServiceImpl();
        //代理角色这时候还不存在
        ProxyInvocationHandler pih = new ProxyInvocationHandler();

        pih.setTarget(userService);//设置要代理的对象
        //动态生成代理
        UserService proxy = (UserService) pih.getProxy();

        proxy.delete();

    }

}
